package com.ruike.alisurface.ui.mainPage;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.ruike.alisurface.R;
import com.ruike.alisurface.Serials.MsgEventBus;
import com.ruike.alisurface.base.BaseAty;
import com.ruike.alisurface.utils.ShareKey;
import com.voodoo.lib_utils.ShareUtils;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Author: voodoo
 * CreateDate: 2024/03/14 014上午 11:12
 * Description: 选择操作方式界面，说白了就一个去购买和取货码取货
 */
public class SelectOperationActivity extends BaseAty {

    @BindView(R.id.selectOperation_goback_imgv)
    ImageView goBackImgv;
    @BindView(R.id.selectOperation_countDown_tv)
    TextView countDownTv;

    @Override
    protected int getLayoutResId() {
        return R.layout.activity_select_operation;
    }

    @Override
    protected void initViews() {
        // 0：轮播图 1：视频 2：无广告
        boolean isNoAdv = ShareUtils.getInstance().getInt(ShareKey.ADV_TYPE, 2) == 2;
        initTitleBar(isNoAdv);
        if (isNoAdv) {
            goBackImgv.setVisibility(View.GONE);
            countDownTv.setVisibility(View.GONE);
        } else {
            goBackImgv.setVisibility(View.VISIBLE);
            countDownTv.setVisibility(View.VISIBLE);
            startCountdownTimer(120, countDownTv, null);
        }
    }

    @Override
    protected void initData() {
    }

    @Override
    public void doEventBusResult(MsgEventBus event) {
    }

    @OnClick({R.id.selectOperation_goback_imgv, R.id.selectOperation_toPay_imgv, R.id.selectOperation_toPickupCode_imgv})
    @Override
    public void onClick(View view) {
        super.onClick(view);
        switch (view.getId()) {
            case R.id.selectOperation_goback_imgv:
                startCountdownTimer(0, null, null);
                break;
            case R.id.selectOperation_toPay_imgv:
                // 1、货道展示  2、商品类型展示
                boolean isSlotShow = ShareUtils.getInstance().getInt(ShareKey.IS_SHOP_TYPE, 1) == 1;
                startActivity(isSlotShow ? MainActivity.class : MainTypeActivity.class, null); // 按货道展示商品
                finish();
                break;
            case R.id.selectOperation_toPickupCode_imgv:
                startActivity(PickupCodeActivity.class, null);
                finish();
                break;
        }
    }
}
